import { request } from "@/utils"

export function getChannelAPI() {
  return request.get("/channels")
}

export function createArticleAPI(data) {
  return request.post("/mp/articles?draft=false", data)
}

export function updateArticleAPI(data) {
  return request.put(`/mp/articles/${data.id}?draft=false`, data)
}

export function getArticleListAPI(params) {
  return request({
    url: "/mp/articles",
    method: "GET",
    params,
  })
}

export function deleteArticleAPI(id) {
  return request.delete(`/mp/articles/${id}`)
}

export function getArticleByIdAPI(id) {
  return request.get(`/mp/articles/${id}`)
}